package com.dq.Service.Impl;

import com.dq.Mapper.CouMapper;
import com.dq.Pojo.Course;
import com.dq.Pojo.Result;
import com.dq.Service.CouService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CouServiceImpl implements CouService {
@Autowired
private CouMapper couMapper;


    public PageInfo<Course> finAll(Integer pageNum, Integer pageSize, String courseName, String startTime) {

        PageHelper.startPage(pageNum,pageSize);
        List<Course> courseList = couMapper.findAll(courseName,startTime);

        PageInfo<Course> pageInfo = new PageInfo<>(courseList);
        return pageInfo;

    }


    public void add(Course course) {
        couMapper.add(course);
    }


    public void delete(Integer id) {
        couMapper.delete(id);
    }


    public void update(Course course) {
        couMapper.update(course);
    }

    @Override
    public List<Course> find() {
        return couMapper.find();
    }

    @Override
    public Course findByid(Integer id) {
        return couMapper.findByid(id);
    }

    @Override
    public List<Course> findstu(Integer id) {
        return couMapper.findstu(id);
    }

}
